package com.neusoft.neu24g1.his5.util;

import com.neusoft.neu24g1.his5.HelloApplication;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;

/**
 * GlobalData 全局
 *
 * @author Administrator
 * @version 2024/06/06 19:33
 **/
public class GlobalData {
    private static Stage stage;

    public static void setStage(Stage stage) {
        GlobalData.stage = stage;
    }

    public static Stage getStage() {
        return stage;
    }

    public  static  void switchScence(String scenceName , int width, int heigth ,String title ) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource(scenceName));
        Scene scene = new Scene(fxmlLoader.load(), width, heigth);
        stage.setTitle(title);
        GlobalData.stage.setScene(scene);
    }
}